package org.hardstone.domain.computer.resource;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import org.hardstone.domain.BaseCategory;
import org.hardstone.domain.BaseItemDomain;
import org.hardstone.domain.Status;

@Entity
@Table(name = "Storage")
public class Storage extends BaseItemDomain<Long> {

    @Column(name = "storageType")
    protected String storageType;             //SSD HDD etc

    @Column(name = "interfaceType")
    protected String interfaceType;           //interface type  e.g. SATA M.2 etc.

    @Column(name = "volume")
    protected Long volume;                    //capacity of Storage @MB

    @Column(name = "usedCapacity")
    protected Long usedCapacity;              //Capacity of used @MB

    @Column(name = "freeSpace")
    protected Long freeSpace;                 //capacity for free @MB

    @Column(name = "usageRate")
    protected Float usageRate;                //usage rate of Storage @%

    @Column(name = "writtenSpeed")
    protected Long writtenSpeed;              //written speed @MB/s

    @Column(name = "readSpeed")
    protected Long readSpeed;                 //read speed @MB/s

    public Storage() {
        super();
        this.storageType = "NoneType";
        this.interfaceType = "NoneType";
        this.volume = 0L;
        this.usedCapacity = 0L;
        this.freeSpace = 0L;
        this.usageRate = 0F;
        this.writtenSpeed = 0L;
        this.readSpeed = 0L;
    }

    public Storage(Long id, Long itemGroupId, String name, BaseCategory category, Long userId, Long userGroupId, int authority, String url, String description, Status status, String askDate, String modifyDate, String tags, String attribute) {
        super(id, itemGroupId, name, category, userId, userGroupId, authority, url, description, status, askDate, modifyDate, tags, attribute);
        this.storageType = "NoneType";
        this.interfaceType = "NoneType";
        this.volume = 0L;
        this.usedCapacity = 0L;
        this.freeSpace = 0L;
        this.usageRate = 0F;
        this.writtenSpeed = 0L;
        this.readSpeed = 0L;
    }

    public Storage(String storageType, String interfaceType, Long volume, Long usedCapacity, Long freeSpace, Float usageRate, Long writtenSpeed, Long readSpeed) {
        super();
        this.storageType = storageType;
        this.interfaceType = interfaceType;
        this.volume = volume;
        this.usedCapacity = usedCapacity;
        this.freeSpace = freeSpace;
        this.usageRate = usageRate;
        this.writtenSpeed = writtenSpeed;
        this.readSpeed = readSpeed;
    }

    public Storage(Long id, Long itemGroupId, String name, BaseCategory category, Long userId, Long userGroupId, int authority, String url, String description, Status status, String askDate, String modifyDate, String tags, String attribute, String storageType, String interfaceType, Long volume, Long usedCapacity, Long freeSpace, Float usageRate, Long writtenSpeed, Long readSpeed) {
        super(id, itemGroupId, name, category, userId, userGroupId, authority, url, description, status, askDate, modifyDate, tags, attribute);
        this.storageType = storageType;
        this.interfaceType = interfaceType;
        this.volume = volume;
        this.usedCapacity = usedCapacity;
        this.freeSpace = freeSpace;
        this.usageRate = usageRate;
        this.writtenSpeed = writtenSpeed;
        this.readSpeed = readSpeed;
    }

    public String getStorageType() {
        return storageType;
    }

    public void setStorageType(String storageType) {
        this.storageType = storageType;
    }

    public String getInterfaceType() {
        return interfaceType;
    }

    public void setInterfaceType(String interfaceType) {
        this.interfaceType = interfaceType;
    }

    public Long getVolume() {
        return volume;
    }

    public void setVolume(Long volume) {
        this.volume = volume;
    }

    public Long getUsedCapacity() {
        return usedCapacity;
    }

    public void setUsedCapacity(Long usedCapacity) {
        this.usedCapacity = usedCapacity;
    }

    public Long getFreeSpace() {
        return freeSpace;
    }

    public void setFreeSpace(Long freeSpace) {
        this.freeSpace = freeSpace;
    }

    public Float getUsageRate() {
        return usageRate;
    }

    public void setUsageRate(Float usageRate) {
        this.usageRate = usageRate;
    }

    public Long getWrittenSpeed() {
        return writtenSpeed;
    }

    public void setWrittenSpeed(Long writtenSpeed) {
        this.writtenSpeed = writtenSpeed;
    }

    public Long getReadSpeed() {
        return readSpeed;
    }

    public void setReadSpeed(Long readSpeed) {
        this.readSpeed = readSpeed;
    }

    @Override
    public String toString() {
        return "Storage{" +
                "storageType='" + storageType + '\'' +
                ", interfaceType='" + interfaceType + '\'' +
                ", volume=" + volume +
                ", usedCapacity=" + usedCapacity +
                ", freeSpace=" + freeSpace +
                ", usageRate=" + usageRate +
                ", writtenSpeed=" + writtenSpeed +
                ", readSpeed=" + readSpeed +
                ", id=" + id +
                ", itemGroupId=" + itemGroupId +
                ", name='" + name + '\'' +
                ", baseCategory=" + baseCategory +
                ", userId=" + userId +
                ", userGroupId=" + userGroupId +
                ", authority=" + authority +
                ", url='" + url + '\'' +
                ", description='" + description + '\'' +
                ", status=" + status +
                ", askDate='" + askDate + '\'' +
                ", modifyDate='" + modifyDate + '\'' +
                ", tags='" + tags + '\'' +
                ", attribute='" + attribute + '\'' +
                '}';
    }
}
